package Simcomp::Process;
use strict;
use warnings;

our $VERSION = "0.01";

sub new
{
	my $class = shift;
	my %attr = ( state => "idle", time_in_disk_queue => 0, time_in_cpu_queue => 0 );
	bless \%attr, $class;
	return \%attr;
	
}

sub set_state
{
	$_[0]->{'state'} = $_[1];
}

sub state
{
	$_[0]->{'state'};
}

sub set_duration
{
	$_[0]->{'duration'} = $_[1];
}

sub duration
{
	$_[0]->{'duration'};
}

sub set_disk
{
	$_[0]->{'disk'} = $_[1];
}

sub disk
{
	$_[0]->{'disk'}
}

sub set_start_time
{
	$_[0]->{'start_time'} = $_[1];
}

sub set_time_in_cpu
{
	$_[0]->{'time_in_cpu'} = $_[1];
}

sub set_time_out_cpu
{
	$_[0]->{'time_out_cpu'} = $_[1];
}

sub set_time_in_disk
{
	$_[0]->{'time_in_disk'} = $_[1];
}

sub set_time_out_disk
{
	$_[0]->{'time_out_disk'} = $_[1];
}

sub time_in_cpu
{
	return $_[0]->{'time_in_cpu'};
}

sub time_in_cpu_queue
{
	my $self = shift;
	return $self->{'time_out_cpu'} - $self->{'start_time'} - $self->{'time_in_cpu'};
}

sub time_in_disk
{
	return $_[0]->{'time_in_disk'};
}

sub time_in_disk_queue
{
	my $self = shift;
	return $self->{'time_out_disk'} - $self->{'time_out_cpu'} - $self->{'time_in_disk'};
}

sub total_time
{
	my $self = shift;
	return $self->{'time_out_disk'} - $self->{'start_time'};
}

1;
